package com.yifeng.repo.base.security.auth;

import com.yifeng.repo.base.dto.PermissionDto;
import com.yifeng.repo.base.dto.UserDto;
import com.yifeng.repo.base.params.ConsoleParam;
import com.yifeng.repo.base.security.auth.constant.SecurityTypeEnum;
import com.yifeng.repo.base.security.context.params.SecurityCheckParam;
import com.yifeng.repo.base.utils.action.BizCacheAction;

import javax.servlet.ServletRequest;
import java.util.List;

/**
 * Created by daibing on 2023/8/24.
 */
public interface SecurityChecker {

    SecurityTypeEnum securityType();

    void init(SecurityCheckParam checkParam, ConsoleParam consoleParam, BizCacheAction bizCacheAction);

    String checkAndGetToken(ServletRequest request);

    UserDto checkAndGetUser(ServletRequest request, String token);

    UserDto getUserByToken(String token);

    PermissionDto checkAndGetPermission(UserDto userDto);

    boolean checkApiSecured(UserDto userDto, String resource);

    boolean checkStoreSecured(UserDto userDto, List<String> storeCodeList);

}
